home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- #include "VCal.h"
- #include "PrintPS.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <Vk/VkApp.h>
- #include <Vk/VkResource.h>
- #include <Vk/VkFatalErrorDialog.h>
-
- static XrmOptionDescRec VCalOptions[] = {
- {
- "-file", "*defaultFilename", XrmoptionSepArg, NULL,
- },
- {
- "-iconName", "*iconName", XrmoptionSepArg, NULL,
- },
- {
- "-title", "*vcal.title", XrmoptionSepArg, NULL,
- },
- {
- "-day", "*dayReport", XrmoptionSepArg, NULL,
- },
- {
- "-week", "*weekReport", XrmoptionSepArg, NULL,
- },
- {
- "-month", "*monthReport", XrmoptionSepArg, NULL,
- },
- {
- "-printMonth", "*monthPrint", XrmoptionSepArg, NULL,
- },
- };
-
- void
- usage()
- {
- fprintf(stderr, "Usage: vcal\n");
- fprintf(stderr,
- " [-file database-file] [-iconName icon-name]\n");
- fprintf(stderr,
- " [-scheme color-scheme] [-title window-title]\n");
- fprintf(stderr,
- " [-day date] [-week date] [-month date]\n");
- fprintf(stderr,
- " [-printMonth date]\n");
- }
-
- void
- main(int argc, char **argv)
- {
- char *str;
- int day, month, year;
-
- VkApp *app = new VkApp("Vcal", &argc, argv,
- VCalOptions, XtNumber(VCalOptions));
-
- if (app->argc() > 1) {
- fprintf(stderr, "%s: Illegal argument '%s'\n", app->argv(0), app->argv(1));
- usage();
- exit(1);
- }
-
- if (!VkGetResource(app->baseWidget(),
- "vcalAppDefaults066", "VcalAppDefaults066")) {
- theFatalErrorDialog->postAndWait("VCal app-defaults file missing or obsolete.\nInstall /usr/lib/X11/app-defaults/Vcal.");
- exit(1);
- }
-
- app->setVersionString("VCal, a simple calendar\nVersion 0.66\nApril 1994\n\nMike Yang\nmikey@sgi.com\nmikey@cs.stanford.edu\n\nCopyright 1994, Silicon Graphics, Inc.");
- VCal *vcal = new VCal("vcal");
-
- vcal->show();
-
- if (str = XGetDefault(app->display(), app->argv(0), "dayReport")) {
- if (parseDate(str, &day, &month, &year)) {
- vcal->emitDay(stdout, day, month, year);
- exit(0);
- } else {
- fprintf(stderr, "Unrecognized date: %s\n", str);
- usage();
- exit(1);
- }
- } else if (str = XGetDefault(app->display(), app->argv(0), "weekReport")) {
- if (parseDate(str, &day, &month, &year)) {
- vcal->emitWeek(stdout, day, month, year);
- exit(0);
- } else {
- fprintf(stderr, "Unrecognized date: %s\n", str);
- usage();
- exit(1);
- }
- } else if (str = XGetDefault(app->display(), app->argv(0), "monthReport")) {
- if (parseMonth(str, &month, &year)) {
- vcal->emitMonth(stdout, day, month, year);
- exit(0);
- } else {
- fprintf(stderr, "Unrecognized date: %s\n", str);
- usage();
- exit(1);
- }
- } else if (str = XGetDefault(app->display(), app->argv(0), "monthPrint")) {
- if (parseMonth(str, &month, &year)) {
- vcal->getPrint()->printMonth(stdout, month, year);
- exit(0);
- } else {
- fprintf(stderr, "Unrecognized date: %s\n", str);
- usage();
- exit(1);
- }
- }
-
- app->run();
- }
-